<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Connecting to Informix databases</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="ref.pdo-informix.html">« Informix (PDO)</a></li>
      <li style="float: right;"><a href="ref.pdo-mysql.html">MySQL (PDO) »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.pdo-informix.html">Informix (PDO)</a></li>
    <li>Connecting to Informix databases</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="ref.pdo-informix.connection" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">PDO_INFORMIX DSN</h1>
    <p class="verinfo">(PECL PDO_INFORMIX &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">PDO_INFORMIX DSN</span> &mdash; <span class="dc-title">Connecting to Informix databases</span></p>

   </div>

   <div class="refsect1 description" id="refsect1-ref.pdo-informix.connection-description">
    <h3 class="title">说明</h3>
    <p class="para">
     The PDO_INFORMIX Data Source Name (DSN) is based on the Informix ODBC DSN
     string. Details on configuring an Informix ODBC DSN are available from
     the <a href="http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp" class="link external">&raquo;&nbsp;Informix Dynamic Server Information
      Center</a>. The major components of the PDO_INFORMIX DSN are:
     <dl>
      
       <dt>
DSN prefix</dt>

       <dd>

        <p class="para">
        The DSN prefix is <strong class="userinput"><code>informix:</code></strong>.
        </p>
       </dd>

      
      
       <dt>
DSN</dt>

       <dd>

        <p class="para">
         The DSN can be either a data source setup using
         <var class="filename">odbc.ini</var> or a complete <a href="http://publib.boulder.ibm.com/infocenter/idshelp/v10/topic/com.ibm.odbc.doc/odbc66.htm#sii02998361" class="link external">&raquo;&nbsp;connection string</a>.
        </p>
       </dd>

      
     </dl>

    </p>
   </div>

   <div class="refsect1 examples" id="refsect1-ref.pdo-informix.connection-examples">
    <h3 class="title">范例</h3>
    <p class="para">
     <div class="example" id="example-1097">
      <p><strong>示例 #1 PDO_INFORMIX DSN example using <var class="filename">odbc.ini</var></strong></p>
      <div class="example-contents"><p>
       The following example shows a PDO_INFORMIX DSN for connecting to
       an Informix database cataloged as Infdrv33 in
       <var class="filename">odbc.ini</var>:
       <div class="example-contents"><div class="cdata"><pre>
$db = new PDO(&quot;informix:DSN=Infdrv33&quot;, &quot;&quot;, &quot;&quot;);
</pre></div></div>

       <div class="example-contents"><div class="cdata"><pre>
[ODBC Data Sources]
Infdrv33=INFORMIX 3.3 32-BIT

[Infdrv33]
Driver=/opt/informix/csdk_2.81.UC1G2/lib/cli/iclis09b.so
Description=INFORMIX 3.3 32-BIT
Database=common_db
LogonID=testuser
pwd=testpass
Servername=ids_server
DB_LOCALE=en_US.819
OPTIMIZEAUTOCOMMIT=1
ENABLESCROLLABLECURSORS=1
</pre></div></div>

      </p></div>
     </div>
     <div class="example" id="example-1098">
      <p><strong>示例 #2 PDO_INFORMIX DSN example using a connection string</strong></p>
      <div class="example-contents"><p>
       The following example shows a PDO_INFORMIX DSN for connecting to
       an Informix database named <strong class="userinput"><code>common_db</code></strong> using the
       Informix connection string syntax.
       <div class="example-contents"><div class="cdata"><pre>
$db = new PDO(&quot;informix:host=host.domain.com; service=9800;
    database=common_db; server=ids_server; protocol=onsoctcp;
    EnableScrollableCursors=1&quot;, &quot;testuser&quot;, &quot;tespass&quot;);
</pre></div>
       </div>

      </p></div>
     </div>
    
    </p>
   </div>

  </div></div></div></body></html>